<canvas id="{{$name}}"></canvas>
<script>
$(function () {
    var ctx = document.getElementById("{{$name}}").getContext('2d');
    var myChart = new Chart(ctx, {
        type: 'bar',
        data: {
            labels: [
            @foreach($data as $k => $v)'{{$k}}',@endforeach
                ],
            datasets: [{
                label: '数量',
                data: [@foreach($data as $k => $v){{$v.','}}@endforeach],
                backgroundColor: [
                    @for($i = 0; $i < count($data); $i ++)'rgba(254,90,0,1)',@endfor
                ],
                borderColor: [
                    'rgba(254,90,0,1)',
                ],
                borderWidth: 1
            }]
        },
        options: {
            scales: {
                yAxes: [{
                    ticks: {
                        beginAtZero:true
                    }
                }]
            }
        }
    });
});
</script>